package com.trhui.mallbook.client;

import com.trhui.mallbook.domain.common.ApiRequest;
import com.trhui.mallbook.domain.common.BaseResponse;
import com.trhui.mallbook.domain.request.hf.HfReceiveRequest;
import com.trhui.mallbook.domain.request.xib.XibReceiveRequest;
import com.trhui.mallbook.domain.request.yb.YbReceiveRequest;
import com.trhui.mallbook.domain.response.hf.HfReceiveResponse;
import com.trhui.mallbook.domain.response.xib.XibReceiveResponse;
import com.trhui.mallbook.domain.response.yb.YbReceiveResponse;
import com.trhui.mallbook.enums.ChannelTypeEnum;
import com.trhui.mallbook.enums.ServerCodeEnum;


/**
 * @author huangh
 * @version 1.0
 * @description 确认收货接口
 * @date 2023/08/17 0017 14:13
 */

public class ReceiveClient extends AbstractClient {


    /**
     * 汇付-确认收货
     * @param request
     * @return
     */
    public static BaseResponse<HfReceiveResponse> hfReceive(HfReceiveRequest request) {
        ApiRequest reqApiRequest = new ApiRequest.ApiRequestBuild()
                .merOrderId(request.getMerOrderId())
                .merchantNo(request.getMerchantNo())
                .params(request)
                .serverCode(ServerCodeEnum.RECEIVE)
                .channelType(ChannelTypeEnum.HF)
                .build();
        return post(reqApiRequest, HfReceiveResponse.class);
    }


    /**
     * 易宝-确认收货
     * @param request
     * @return
     */
    public static BaseResponse<YbReceiveResponse> ybReceive(YbReceiveRequest request) {
        ApiRequest reqApiRequest = new ApiRequest.ApiRequestBuild()
                .merOrderId(request.getMerOrderId())
                .merchantNo(request.getMerchantNo())
                .params(request)
                .serverCode(ServerCodeEnum.RECEIVE)
                .channelType(ChannelTypeEnum.YB)
                .build();
        return post(reqApiRequest, YbReceiveResponse.class);
    }


    /**
     * 厦门国际银行-确认收货
     * @param request
     * @return
     */
    public static BaseResponse<XibReceiveResponse> xibReceive(XibReceiveRequest request) {
        ApiRequest reqApiRequest = new ApiRequest.ApiRequestBuild()
                .merOrderId(request.getMerOrderId())
                .merchantNo(request.getMerchantNo())
                .params(request)
                .serverCode(ServerCodeEnum.RECEIVE)
                .channelType(ChannelTypeEnum.XIB)
                .build();
        return post(reqApiRequest, XibReceiveResponse.class);
    }

}
